import request from "@/utils/request";
import { ConstructorForm } from "@/api/account/constructor/types";

/**
 * 建设单位注册
 *
 * @param data
 */
export function constructorReg(data: ConstructorForm) {
  return request({
    url: "/api/v1/account/constructor_reg",
    method: "post",
    data: data,
  });
}

/**
 * 建设单位是否已存在
 *
 * @param data
 */
export function constructorExists(code: string) {
  return request({
    url: "/api/v1/account/constructor_exists",
    method: "get",
    params: { code: code },
  });
}

//根据token获取建设单位详情
export function getConstructorInfo(editToken: string) {
  return request({
    url: "/api/v1/auth/getConstructor/" + editToken,
    method: "get",
  });
}

//完善建设单位信息
export function constructorLogin(data: ConstructorForm) {
  return request({
    url: "/api/v1/auth/constructorLogin",
    method: "put",
    data: data,
  });
}

//获取建设单位详情
export function getConstructor() {
  return request({
    url: "/api/v1/constructor/Constructor/getConstructorInfo",
    method: "get",
  });
}

//修改建设单位信息
export function updateConstructor(data: ConstructorForm) {
  return request({
    url: "/api/v1/constructor/Constructor/updateConstructor",
    method: "put",
    data: data,
  });
}

//修改建设单位密码
export function updateConstructorPassWord(passWord: string) {
  return request({
    url: "/api/v1/constructor/Constructor/updateConstructorPassWord",
    method: "put",
    params: { passWord: passWord},
  });
}
